/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CajeroMainPanel.java
 *
 * Created on 07-nov-2009, 14:55:12
 */

package scapi.gui;

import com.toedter.calendar.JDateChooser;
import java.awt.Component;
import java.awt.event.KeyEvent;
import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractListModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;
import scapi.entidades.BoletaEmpenio;
import scapi.entidades.Direccion;
import scapi.entidades.EsperadorCajero;
import scapi.entidades.Joya;
import scapi.entidades.Pignorante;
import scapi.entidades.Prenda;
import scapi.entidades.Producto;

import scapi.servidor.servidores.ServidorAEmpenio;
import scapi.servidor.servidores.ServidorCola;
import scapi.servidor.servidores.ServidorReporte;
import scapi.utilerias.EValidacion;
import scapi.utilerias.ExcepcionValidacion;
import scapi.utilerias.ServidorFactory;

/**
 *
 * @author Admin
 */
public class CajeroMainPanel extends javax.swing.JPanel {
    private ServidorCola servCola;
    private Pignorante pign;
    private Producto producto;
    private ServidorAEmpenio servEmpenio;
    private ServidorReporte reportes;

    private Timer timer;


    
    /** Creates new form CajeroMainPanel */
    public CajeroMainPanel() {
        initComponents();

         try {

           servCola = (ServidorCola) ServidorFactory.obtenerServidor(ServidorFactory.ServidorCola);
           servEmpenio = (ServidorAEmpenio) ServidorFactory.obtenerServidor(ServidorFactory.ServidorEmpenio);
           reportes = (ServidorReporte) ServidorFactory.obtenerServidor(ServidorFactory.ServidorReportes);



        } catch (RemoteException ex) {
           JOptionPane.showMessageDialog(this, "Imposible conectar a servidor","ERROR", JOptionPane.ERROR_MESSAGE);
        } catch(Exception e){
            e.printStackTrace();
        }

        timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {
            public void run() {
                try {
                    actualizarJList();
                   
                } catch (RemoteException ex) {
                    Logger.getLogger(CajeroMainPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
               
            }
        }, 0, 5000);

       Calendar hoy = Calendar.getInstance();
       hoy.add(Calendar.MONTH, 3);
       dtFiniquito.setDate(hoy.getTime());

       Calendar hoy2 = Calendar.getInstance();
       hoy2.add(Calendar.MONTH, 3);
       hoy2.add(Calendar.DATE,10);
       dtComercializacion.setDate(hoy2.getTime());
     
       
        


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        pnDatosPig = new javax.swing.JPanel();
        lblNombre = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        lblApellidos = new javax.swing.JLabel();
        txtApPaterno = new javax.swing.JTextField();
        lblFecNac = new javax.swing.JLabel();
        lblSexo = new javax.swing.JLabel();
        lblTelefono = new javax.swing.JLabel();
        txtTelefono = new javax.swing.JTextField();
        lblEmail = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        lblRFC = new javax.swing.JLabel();
        txtRFC = new javax.swing.JTextField();
        txtApMaterno = new javax.swing.JTextField();
        rbHombre = new javax.swing.JRadioButton();
        rbMujer = new javax.swing.JRadioButton();
        pnDireccion = new javax.swing.JPanel();
        lblCalle = new javax.swing.JLabel();
        lblNumero = new javax.swing.JLabel();
        lblColonia = new javax.swing.JLabel();
        lblCodigo = new javax.swing.JLabel();
        lblDelegacion = new javax.swing.JLabel();
        lblEstado = new javax.swing.JLabel();
        txtCalle = new javax.swing.JTextField();
        txtNumExt = new javax.swing.JTextField();
        txtColonia = new javax.swing.JTextField();
        txtCodigoPostal = new javax.swing.JTextField();
        txtDekegacion = new javax.swing.JTextField();
        txtEstado = new javax.swing.JTextField();
        txtNumInt = new javax.swing.JTextField();
        dtFechaNac = new com.toedter.calendar.JDateChooser();
        pnDTProd = new javax.swing.JPanel();
        JLVnom_pro = new javax.swing.JLabel();
        TFVnom_pro = new javax.swing.JTextField();
        JLVdesc_pro = new javax.swing.JLabel();
        SPVdescripcion = new javax.swing.JScrollPane();
        TAVdescripcion = new javax.swing.JTextArea();
        JLVcategoria = new javax.swing.JLabel();
        CBVcategoria = new javax.swing.JComboBox();
        JPVjoyas = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        TAMaterial = new javax.swing.JTextArea();
        JPVmarcamodelo = new javax.swing.JPanel();
        TFVmodelo = new javax.swing.JTextField();
        TFVmarca = new javax.swing.JTextField();
        JLVmarca = new javax.swing.JLabel();
        JLVmodelo = new javax.swing.JLabel();
        JLVavaluo = new javax.swing.JLabel();
        TFVavaluo = new javax.swing.JTextField();
        CBVpresentacion = new javax.swing.JComboBox();
        JLVpres_pro = new javax.swing.JLabel();
        JLVprestamo = new javax.swing.JLabel();
        TFVprestamo = new javax.swing.JTextField();
        pnCaracteristicas = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtMonto = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        cmbTipoPago = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        lblCantPago = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        lblInteres = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        dtFiniquito = new com.toedter.calendar.JDateChooser();
        jLabel9 = new javax.swing.JLabel();
        dtComercializacion = new com.toedter.calendar.JDateChooser();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        lstFila = new javax.swing.JList();
        jButton3 = new javax.swing.JButton();

        setLayout(new java.awt.BorderLayout());

        jButton1.setText("Aceptar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton1);

        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton2);

        add(jPanel1, java.awt.BorderLayout.PAGE_END);

        pnDatosPig.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pignorante"));

        lblNombre.setText("Nombre");

        txtNombre.setEditable(false);

        lblApellidos.setText("Apellidos");

        txtApPaterno.setEditable(false);

        lblFecNac.setText("Fec Nac");

        lblSexo.setText("Sexo");

        lblTelefono.setText("Telefono");

        txtTelefono.setEditable(false);

        lblEmail.setText("E-Mail");

        txtEmail.setEditable(false);

        lblRFC.setText("RFC");

        txtRFC.setEditable(false);

        txtApMaterno.setEditable(false);

        buttonGroup1.add(rbHombre);
        rbHombre.setText("Hombre");
        rbHombre.setEnabled(false);

        buttonGroup1.add(rbMujer);
        rbMujer.setText("Mujer");
        rbMujer.setEnabled(false);

        lblCalle.setText("Calle");

        lblNumero.setText("Numero");

        lblColonia.setText("Colonia");

        lblCodigo.setText("C.P.");

        lblDelegacion.setText("Delegacion");

        lblEstado.setText("Estado");

        txtCalle.setEditable(false);

        txtNumExt.setEditable(false);

        txtColonia.setEditable(false);

        txtCodigoPostal.setEditable(false);

        txtDekegacion.setEditable(false);

        txtEstado.setEditable(false);

        txtNumInt.setEditable(false);

        javax.swing.GroupLayout pnDireccionLayout = new javax.swing.GroupLayout(pnDireccion);
        pnDireccion.setLayout(pnDireccionLayout);
        pnDireccionLayout.setHorizontalGroup(
            pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDireccionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCodigo)
                    .addComponent(lblColonia)
                    .addGroup(pnDireccionLayout.createSequentialGroup()
                        .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDelegacion)
                            .addComponent(lblCalle)
                            .addComponent(lblNumero))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtCodigoPostal, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEstado)
                            .addComponent(txtColonia)
                            .addGroup(pnDireccionLayout.createSequentialGroup()
                                .addComponent(txtNumExt, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtNumInt))
                            .addComponent(txtCalle, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
                            .addComponent(txtDekegacion)))
                    .addComponent(lblEstado))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        pnDireccionLayout.setVerticalGroup(
            pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDireccionLayout.createSequentialGroup()
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCalle)
                    .addComponent(txtCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumero)
                    .addComponent(txtNumExt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNumInt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblColonia)
                    .addComponent(txtColonia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCodigo)
                    .addComponent(txtCodigoPostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDelegacion)
                    .addComponent(txtDekegacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEstado)
                    .addComponent(txtEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        dtFechaNac.setEnabled(false);

        javax.swing.GroupLayout pnDatosPigLayout = new javax.swing.GroupLayout(pnDatosPig);
        pnDatosPig.setLayout(pnDatosPigLayout);
        pnDatosPigLayout.setHorizontalGroup(
            pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDatosPigLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnDatosPigLayout.createSequentialGroup()
                        .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSexo)
                            .addComponent(lblTelefono)
                            .addComponent(lblEmail)
                            .addComponent(lblRFC))
                        .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnDatosPigLayout.createSequentialGroup()
                                .addGap(15, 15, 15)
                                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(pnDatosPigLayout.createSequentialGroup()
                                        .addGap(20, 20, 20)
                                        .addComponent(rbHombre)
                                        .addGap(18, 18, 18)
                                        .addComponent(rbMujer))
                                    .addComponent(txtEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
                                    .addComponent(txtRFC, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)))
                            .addGroup(pnDatosPigLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtTelefono, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE))))
                    .addGroup(pnDatosPigLayout.createSequentialGroup()
                        .addComponent(lblNombre)
                        .addGap(18, 18, 18)
                        .addComponent(txtNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE))
                    .addGroup(pnDatosPigLayout.createSequentialGroup()
                        .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblApellidos)
                            .addGroup(pnDatosPigLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblFecNac)))
                        .addGap(12, 12, 12)
                        .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnDatosPigLayout.createSequentialGroup()
                                .addComponent(txtApPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(dtFechaNac, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE))))
                .addGap(197, 197, 197))
            .addGroup(pnDatosPigLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnDatosPigLayout.setVerticalGroup(
            pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDatosPigLayout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombre)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblApellidos)
                    .addComponent(txtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblFecNac)
                    .addComponent(dtFechaNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(17, 17, 17)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSexo)
                    .addComponent(rbMujer)
                    .addComponent(rbHombre))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTelefono)
                    .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEmail)
                    .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDatosPigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRFC)
                    .addComponent(txtRFC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(pnDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnDTProd.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Producto"));

        JLVnom_pro.setText("Producto");

        TFVnom_pro.setEditable(false);

        JLVdesc_pro.setText("Descripcion");

        TAVdescripcion.setColumns(10);
        TAVdescripcion.setEditable(false);
        TAVdescripcion.setRows(4);
        SPVdescripcion.setViewportView(TAVdescripcion);

        JLVcategoria.setText("Categoria");

        CBVcategoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Seleccionar--", "Electronica", "Joyeria" }));
        CBVcategoria.setEnabled(false);

        jLabel2.setText("Material(es)");

        TAMaterial.setColumns(14);
        TAMaterial.setEditable(false);
        TAMaterial.setRows(3);
        jScrollPane2.setViewportView(TAMaterial);

        javax.swing.GroupLayout JPVjoyasLayout = new javax.swing.GroupLayout(JPVjoyas);
        JPVjoyas.setLayout(JPVjoyasLayout);
        JPVjoyasLayout.setHorizontalGroup(
            JPVjoyasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPVjoyasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPVjoyasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        JPVjoyasLayout.setVerticalGroup(
            JPVjoyasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPVjoyasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        TFVmodelo.setEditable(false);

        TFVmarca.setEditable(false);
        TFVmarca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TFVmarcaActionPerformed(evt);
            }
        });

        JLVmarca.setText("Marca");

        JLVmodelo.setText("Modelo");

        javax.swing.GroupLayout JPVmarcamodeloLayout = new javax.swing.GroupLayout(JPVmarcamodelo);
        JPVmarcamodelo.setLayout(JPVmarcamodeloLayout);
        JPVmarcamodeloLayout.setHorizontalGroup(
            JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPVmarcamodeloLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JLVmodelo)
                    .addComponent(JLVmarca))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(TFVmodelo)
                    .addComponent(TFVmarca, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        JPVmarcamodeloLayout.setVerticalGroup(
            JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPVmarcamodeloLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLVmarca)
                    .addComponent(TFVmarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(JPVmarcamodeloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLVmodelo)
                    .addComponent(TFVmodelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        JLVavaluo.setText("Avaluo");

        TFVavaluo.setEditable(false);

        CBVpresentacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Muy buena", "Buena", "Regular", "Mala", "Muy mala" }));
        CBVpresentacion.setSelectedIndex(1);
        CBVpresentacion.setEnabled(false);
        CBVpresentacion.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                CBVpresentacionItemStateChanged(evt);
            }
        });

        JLVpres_pro.setText("Presentacion");

        JLVprestamo.setText("Prestamo");

        TFVprestamo.setEditable(false);

        javax.swing.GroupLayout pnDTProdLayout = new javax.swing.GroupLayout(pnDTProd);
        pnDTProd.setLayout(pnDTProdLayout);
        pnDTProdLayout.setHorizontalGroup(
            pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDTProdLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JLVpres_pro)
                    .addComponent(JLVprestamo)
                    .addComponent(JLVnom_pro)
                    .addComponent(JLVdesc_pro)
                    .addComponent(JLVavaluo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CBVpresentacion, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TFVprestamo, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(TFVavaluo, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(SPVdescripcion, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                        .addComponent(TFVnom_pro, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnDTProdLayout.createSequentialGroup()
                        .addComponent(JLVcategoria)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(CBVcategoria, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(JPVmarcamodelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JPVjoyas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        pnDTProdLayout.setVerticalGroup(
            pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnDTProdLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLVnom_pro)
                    .addComponent(TFVnom_pro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLVcategoria)
                    .addComponent(CBVcategoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnDTProdLayout.createSequentialGroup()
                        .addComponent(JPVmarcamodelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(JPVjoyas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(pnDTProdLayout.createSequentialGroup()
                        .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(SPVdescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(JLVdesc_pro))
                        .addGap(6, 6, 6)
                        .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(JLVavaluo)
                            .addComponent(TFVavaluo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(JLVpres_pro)
                            .addComponent(CBVpresentacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnDTProdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TFVprestamo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(JLVprestamo))))
                .addContainerGap())
        );

        pnCaracteristicas.setBorder(javax.swing.BorderFactory.createTitledBorder("Caracteristicas"));

        jLabel1.setText("Monto Prestamo");

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, TFVprestamo, org.jdesktop.beansbinding.ELProperty.create("${text}"), txtMonto, org.jdesktop.beansbinding.BeanProperty.create("text"), "Monto");
        bindingGroup.addBinding(binding);

        txtMonto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtMontoKeyPressed(evt);
            }
        });

        jLabel3.setText("Tipo de Pago");

        cmbTipoPago.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Semanal", "Mensual" }));
        cmbTipoPago.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cmbTipoPagoItemStateChanged(evt);
            }
        });

        jLabel4.setText("Cant Pago");

        lblCantPago.setFont(new java.awt.Font("DejaVu Sans", 0, 24));
        lblCantPago.setForeground(new java.awt.Color(255, 0, 0));
        lblCantPago.setText("$000.00");

        jLabel6.setText("Interes");

        lblInteres.setText("10");

        jLabel8.setText("fechaFiniquito");

        jLabel9.setText("Fec Comer");

        jLabel7.setText("%");

        javax.swing.GroupLayout pnCaracteristicasLayout = new javax.swing.GroupLayout(pnCaracteristicas);
        pnCaracteristicas.setLayout(pnCaracteristicasLayout);
        pnCaracteristicasLayout.setHorizontalGroup(
            pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnCaracteristicasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(jLabel8)
                    .addComponent(jLabel4)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cmbTipoPago, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtMonto, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                    .addGroup(pnCaracteristicasLayout.createSequentialGroup()
                        .addComponent(lblInteres)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addComponent(dtFiniquito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblCantPago)
                    .addComponent(dtComercializacion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(149, Short.MAX_VALUE))
        );
        pnCaracteristicasLayout.setVerticalGroup(
            pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnCaracteristicasLayout.createSequentialGroup()
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtMonto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(cmbTipoPago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(lblInteres)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8)
                    .addComponent(dtFiniquito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9)
                    .addComponent(dtComercializacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnCaracteristicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(lblCantPago))
                .addGap(35, 35, 35))
        );

        lstFila.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        lstFila.setEnabled(false);
        jScrollPane1.setViewportView(lstFila);

        jButton3.setText("Siguiente");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnDatosPig, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(pnCaracteristicas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)))
                    .addComponent(pnDTProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnDatosPig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(pnDTProd, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(pnCaracteristicas, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jButton3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(71, 71, 71))
        );

        add(jPanel2, java.awt.BorderLayout.CENTER);

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

    private void TFVmarcaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TFVmarcaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TFVmarcaActionPerformed

    private void CBVpresentacionItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_CBVpresentacionItemStateChanged
System.out.println(CBVpresentacion.getSelectedIndex());
        switch (CBVpresentacion.getSelectedIndex()) {
            case 0:
                try {
                    float pres = (float) (0.85 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 1:
                try {
                    float pres = (float) (0.75 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 2:
                try {
                    float pres = (float) (0.65 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 3:
                try {
                    float pres = (float) (0.55 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 4:
                try {
                    float pres = (float) (0.45 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            default:
                break;

        }        // TODO add your handling code here:
    }//GEN-LAST:event_CBVpresentacionItemStateChanged

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            float prestamo = EValidacion.flotante(txtMonto.getText(), "Prestamo");
            int interes = EValidacion.entero(lblInteres.getText(), "Intereses");
            String lapso = (String) cmbTipoPago.getSelectedItem();
            //VAlidacion aqui
           // BoletaEmpenio bol = new BoletaEmpenio(WIDTH, null, prestamo, prestamo, interes, producto, pign, null, interes, lapso)
            BoletaEmpenio bol = new BoletaEmpenio(0, new Date(),(float) producto.getPrecio(), prestamo, 0, producto, pign,null, interes, lapso);
            servEmpenio.nuevoEmpenio(1, bol);
            
            JOptionPane.showMessageDialog(this,"Alta exitosa");

            reiniciarFomulario();

            HashMap<String,String> hm = new HashMap<String,String>();

            int folio = servEmpenio.ultimoFolio();
            float totalPago = servEmpenio.cantTotalPagar(folio);
            int numPagos = servEmpenio.getNumeroPagos(folio);
            float interesGen = servEmpenio.intereseGen(folio);

            hm.put("fol_bol", ""+folio);
            hm.put("total_pago", ""+totalPago);
            hm.put("num_pago",""+numPagos);
            hm.put("refrendo", ""+interesGen);



            JasperPrint print = reportes.getReporte("BoletaEmpenio.jasper", hm);

            JasperViewer.viewReport(print,false);




        } catch (ExcepcionValidacion ex) {
            JOptionPane.showConfirmDialog(this, ex.getMessage(),"ERROR", JOptionPane.ERROR_MESSAGE);
        }catch(Exception e){
            e.printStackTrace();
        }
        // BoletaEmpenio bol = new BoletaEmpenio(, null, TOP_ALIGNMENT, TOP_ALIGNMENT, WIDTH, null, null, null, WIDTH, TOOL_TIP_TEXT_KEY), null, TOP_ALIGNMENT, TOP_ALIGNMENT, WIDTH, null, null, null, WIDTH, TOOL_TIP_TEXT_KEY)
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        EsperadorCajero esperador;
        try {
            esperador = servCola.sigColaCajero(1);
            llenarFormulario(esperador);
            actualizarJList();
        } catch (RemoteException ex) {
            ex.printStackTrace();
        }
        
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void txtMontoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMontoKeyPressed
        if(evt.getKeyCode() == KeyEvent.VK_ENTER){
            int interes = Integer.parseInt(lblInteres.getText());
            float prestamo = Float.parseFloat(txtMonto.getText());
            String lapso = (String) cmbTipoPago.getSelectedItem();

            float interesGenerado = (prestamo * (float) interes * 3)/100;

            float cantidadPago =0;

            if(lapso.equals("Semanal")){
				cantidadPago = (interesGenerado + prestamo)/12;

			}else if(lapso.equals("Mensual")){
				cantidadPago = (interesGenerado + prestamo)/3;

			}else if(lapso.equals("Anual")){
				cantidadPago = (interesGenerado + prestamo)/3;
			}

            lblCantPago.setText("$"+ cantidadPago);
        }


        // TODO add your handling code here:
    }//GEN-LAST:event_txtMontoKeyPressed

    private void cmbTipoPagoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbTipoPagoItemStateChanged
        int interes = Integer.parseInt(lblInteres.getText());
            float prestamo = Float.parseFloat(txtMonto.getText());
            String lapso = (String) cmbTipoPago.getSelectedItem();

            float interesGenerado = (prestamo * (float) interes * 3)/100;

            float cantidadPago =0;

            if(lapso.equals("Semanal")){
				cantidadPago = ((interesGenerado + prestamo) / 12);

			}else if(lapso.equals("Mensual")){
				cantidadPago =  ((interesGenerado + prestamo) / 3);

			}else if(lapso.equals("Anual")){
				cantidadPago =  ((interesGenerado + prestamo) / 3);
			}

            lblCantPago.setText("$"+ cantidadPago);

        // TODO add your handling code here:
    }//GEN-LAST:event_cmbTipoPagoItemStateChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

        reiniciarFomulario();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

     private void limpiarPanel(JPanel panel){
        Component[] comp = panel.getComponents();
        for (int i = 0; i < comp.length; i++) {
            Component component = comp[i];
            if(component instanceof JTextField){
                JTextField componente = (JTextField) component;
                componente.setText("");
            }else if(component instanceof JComboBox){
                JComboBox comp2 = (JComboBox) component;
                comp2.setSelectedIndex(0);

            }else if(component instanceof JCheckBox){
                JCheckBox box = (JCheckBox) component;
                box.setSelected(false);
            }else if(component instanceof JDateChooser){
                JDateChooser date = (JDateChooser) component;
                date.setDate(null);
            }


        }

    }

     private void reiniciarFomulario(){
         limpiarPanel(pnCaracteristicas);
         limpiarPanel(pnDTProd);
         limpiarPanel(pnDatosPig);
         limpiarPanel(pnDireccion);
         limpiarPanel(JPVjoyas);
         limpiarPanel(JPVmarcamodelo);

         TAMaterial.setText("");
         TAVdescripcion.setText("");
     }

    private void llenarFormulario(EsperadorCajero esperador){
        pign = esperador.getPignorante();
        producto = esperador.getProducto();
        Joya joya = null;
        Prenda prenda = null;

        txtNombre.setText(pign.getNombre());
        txtApPaterno.setText(pign.getApPaterno());
        txtApMaterno.setText(pign.getApMaterno());
        dtFechaNac.setDate(pign.getDtFechaNac());
        if(pign.getSexo() == 'h')
            rbHombre.setSelected(true);
        else{
           rbMujer.setSelected(true);
        }

        txtTelefono.setText(""+pign.getTelefono());
        txtEmail.setText(pign.getEmail());
        txtRFC.setText(pign.getRfc());

        Direccion dir = pign.getDireccion();

        txtCalle.setText(dir.getCalle());
        txtColonia.setText(dir.getColonia());
        txtDekegacion.setText(dir.getDelegacion());
        txtEstado.setText(dir.getEstado());
        txtNumInt.setText(dir.getNumInt());
        txtNumExt.setText(""+dir.getNumExt());
        txtCodigoPostal.setText(""+dir.getCodPostal());

        if(producto instanceof Joya){
                joya = (Joya) producto;
                  TAMaterial.setText(joya.getMaterial());

              

         




            } else{
                prenda = (Prenda) producto;
                TFVmarca.setText(prenda.getMarca());
                TFVmodelo.setText(prenda.getModelo());
              
             


            }
        TFVnom_pro.setText(producto.getNombre());
        TFVavaluo.setText(""+producto.getPrecio());
        CBVpresentacion.setSelectedItem(producto.getPresentacion());
        CBVcategoria.setSelectedIndex(producto.getCatalogo());

        switch (CBVpresentacion.getSelectedIndex()) {
            case 0:
                try {
                    float pres = (float) (0.85 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 1:
                try {
                    float pres = (float) (0.75 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 2:
                try {
                    float pres = (float) (0.65 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 3:
                try {
                    float pres = (float) (0.55 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            case 4:
                try {
                    float pres = (float) (0.45 * EValidacion.flotante(TFVavaluo.getText(), "Avaluo"));
                    TFVprestamo.setText("" + pres);
                } catch (ExcepcionValidacion e){
                    System.out.println(e.getMessage());
                }
                break;
            default:
                break;

        }   

    }

    private void  actualizarJList() throws RemoteException {
        lstFila.setModel(new AbstractListModel() {
         
            
        EsperadorCajero[] fila = servCola.obtenerFilaCajero(1);
        

            public int getSize() {
                return fila.length;
            }

            public Object getElementAt(int index) {
                return fila[index];
            }
        });
     
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox CBVcategoria;
    private javax.swing.JComboBox CBVpresentacion;
    private javax.swing.JLabel JLVavaluo;
    private javax.swing.JLabel JLVcategoria;
    private javax.swing.JLabel JLVdesc_pro;
    private javax.swing.JLabel JLVmarca;
    private javax.swing.JLabel JLVmodelo;
    private javax.swing.JLabel JLVnom_pro;
    private javax.swing.JLabel JLVpres_pro;
    private javax.swing.JLabel JLVprestamo;
    private javax.swing.JPanel JPVjoyas;
    private javax.swing.JPanel JPVmarcamodelo;
    private javax.swing.JScrollPane SPVdescripcion;
    private javax.swing.JTextArea TAMaterial;
    private javax.swing.JTextArea TAVdescripcion;
    private javax.swing.JTextField TFVavaluo;
    private javax.swing.JTextField TFVmarca;
    private javax.swing.JTextField TFVmodelo;
    private javax.swing.JTextField TFVnom_pro;
    private javax.swing.JTextField TFVprestamo;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox cmbTipoPago;
    private com.toedter.calendar.JDateChooser dtComercializacion;
    private com.toedter.calendar.JDateChooser dtFechaNac;
    private com.toedter.calendar.JDateChooser dtFiniquito;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblApellidos;
    private javax.swing.JLabel lblCalle;
    private javax.swing.JLabel lblCantPago;
    private javax.swing.JLabel lblCodigo;
    private javax.swing.JLabel lblColonia;
    private javax.swing.JLabel lblDelegacion;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblEstado;
    private javax.swing.JLabel lblFecNac;
    private javax.swing.JLabel lblInteres;
    private javax.swing.JLabel lblNombre;
    private javax.swing.JLabel lblNumero;
    private javax.swing.JLabel lblRFC;
    private javax.swing.JLabel lblSexo;
    private javax.swing.JLabel lblTelefono;
    private javax.swing.JList lstFila;
    private javax.swing.JPanel pnCaracteristicas;
    private javax.swing.JPanel pnDTProd;
    private javax.swing.JPanel pnDatosPig;
    private javax.swing.JPanel pnDireccion;
    private javax.swing.JRadioButton rbHombre;
    private javax.swing.JRadioButton rbMujer;
    private javax.swing.JTextField txtApMaterno;
    private javax.swing.JTextField txtApPaterno;
    private javax.swing.JTextField txtCalle;
    private javax.swing.JTextField txtCodigoPostal;
    private javax.swing.JTextField txtColonia;
    private javax.swing.JTextField txtDekegacion;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtEstado;
    private javax.swing.JTextField txtMonto;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtNumExt;
    private javax.swing.JTextField txtNumInt;
    private javax.swing.JTextField txtRFC;
    private javax.swing.JTextField txtTelefono;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

}
